package CSCE428;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayDeque;

public class RegularExpression {
	public static void main(String[] args) throws FileNotFoundException {
		String regExpression="";
		String matched="";
		
		try{
		BufferedReader input =  new BufferedReader(new FileReader(new File("E:/UNL/Eclipse JAVA/workspace/CSCE428/src/test1.txt")));
		regExpression=input.readLine();
        NFA nfa = new NFA();
        NFAtoDFA n2d = new NFAtoDFA();
        Match match = new Match();
        boolean a;
        ArrayDeque<NFAState> b = new ArrayDeque<NFAState>();
        b = n2d.ConvertNFAtoDFA(nfa.CreateNFA(regExpression), nfa.InputSet);
        while((matched=input.readLine())!=null && !matched.isEmpty()){
        a = match.MatchRegressionExpression(b,matched, nfa.InputSet);
        if (a){
        	System.out.println("yes");
        }
        else{
        	System.out.println("No");
        }
        }

	}catch(Exception e){
		System.out.println(e);
	}
	}

}
